/*
 * 컴파일을 위해 올려 놓은 소스 입니다.
 * 서버에 반영하지 마시고 다른국가에 적용할 경우 서버에 있는 class 를 카피해서 사용하십시오.
 * 
 */
package com.pushmsg.otaconf;

public class OtaConfMsgHdr 
{
	final private byte  hdrlen  = 0x0B;
	final private byte  udhie = 0x05;
	final private byte  portlen = 0x04;
	final private short  destport =(short)49999;	
	final private short srcport = (short)49154;
	final private byte   msgsar=0x00;
	final private byte  udhsarlen = 0x03;
	final private byte  refno = 0x04;
	
	private byte totno;
	private byte curno;
	
	private byte[] data = new byte[hdrlen+1];
	
	public OtaConfMsgHdr(int total)
	{
		totno = (byte)total;		
	}

	public OtaConfMsgHdr()
	{
	}
	
	public void setCurno(int no)
	{
		curno = (byte)no;
	}
	
	public void setTotalno(int no)
	{
		totno = (byte)no;
	}	
	protected int getLength()
	{
		return data.length;
	}
	
	protected byte[] getData()
	{
		int ndx=0;
		data[ndx++] = hdrlen;
		data[ndx++] = udhie;
		data[ndx++] = portlen;
		data[ndx++] = (byte)((destport>>8)&0xFF);
		data[ndx++] = (byte)(0xFF&destport);
		data[ndx++] = (byte)((srcport>>8)&0xFF);
		data[ndx++] = (byte)(0xFF&srcport);
		data[ndx++] = msgsar;
		data[ndx++] = udhsarlen;
		data[ndx++] = refno;
		data[ndx++] = totno;
		data[ndx++] = curno;
		return data;
	}
}